<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:include page="/WEB-INF/jsp/include/head.jsp" />
<%@ page language="java" pageEncoding="utf-8" %>
<div class="container">
    <div style="margin-bottom: 15px;">
    <c:choose>
        <c:when test="${pageContext.request.getParameter('keyword')!= null}">
            <p>
                以下是：<font color="red">${pageContext.request.getParameter("keyword")}</font> 的搜索结果
            </p>
        </c:when>
        <c:otherwise>
            <a href="${pageContext.request.contextPath}/message/send" class="btn btn-info">发布新的留言</a>
        </c:otherwise>
    </c:choose>
    </div>
    <table class="table table-bordered table-striped">
        <tr>
            <td>ID</td>
            <td>内容</td>
            <td>发布人</td>
            <td>发布时间</td>
        </tr>
        <c:forEach var="item" items="${list}">
            <tr>
                <td>${item.id}</td>
                <td><a href="${pageContext.request.contextPath}/message/${item.id}">${item.content}</a></td>
                <td>${item.username}</td>
                <td>${item.createTime}</td>
            </tr>
        </c:forEach>
    </table>
</div>
<jsp:include page="/WEB-INF/jsp/include/footer.jsp" />